from abc import ABCMeta, abstractmethod
from configparser import DEFAULTSECT


class ConfigParserMoudle():
    """
    config 解析的默认参数 防止以后需要使用 现在全部使用默认
    """
    def __init__(self):
        self.defaults = None
        self.allow_no_value = False
        self.delimiters = ('=', ':')
        self.comment_prefixes = ('#', ';')
        self.inline_comment_prefixes = None
        self.strict = True
        self.empty_lines_in_values = True
        self.default_section = DEFAULTSECT

    def to_dict(self):
        return self.__dict__

    def __str__(self):
        return str(self.__dict__)


class ConfigParserBuilderAbstract:
    __metaclass__ = ABCMeta

    @abstractmethod
    def build_defaults(self):
        pass

    @abstractmethod
    def build_allow_no_value(self):
        pass

    @abstractmethod
    def build_delimiters(self):
        pass

    @abstractmethod
    def build_comment_prefixes(self):
        pass

    @abstractmethod
    def use_inline_comment_prefixes(self):
        pass

    @abstractmethod
    def build_strict(self):
        pass

    @abstractmethod
    def use_empty_lines_in_values(self):
        pass

    @abstractmethod
    def build_default_section(self):
        pass

    @abstractmethod
    def get_moudle(self):
        pass


default_config_parser_moudle = ConfigParserMoudle()
